package mvc.util;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class FullBean {

	public static Object full(HttpServletRequest req){
		Object o = null;
		try {
			Class clazz = Class.forName(req.getParameter("sign"));
			o = clazz.newInstance();
			Field[] fields = clazz.getDeclaredFields();
			for(Field field:fields){
				field.setAccessible(true);
				field.set(o, req.getParameter(field.getName()));
				field.setAccessible(false);
				
			}
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return o;
	}
}
